import java.util.InputMismatchException;
import java.util.Scanner;


public class ExceptionHandelTest {
    public static void main(String[] args) {
        Scanner scanner = null;
        try {
            scanner = new Scanner(System.in);
            int num = scanner.nextInt();
            System.out.println(num);
            scanner.close();
            return;
        } catch (InputMismatchException e) {
            System.out.println("出现了InputMismatchException异常");
            e.printStackTrace();
            return;

        }
        finally{//在开发中有一些资源，使用完后，需要显式回收，例如流资源的关闭操作
            System.out.println("异常处理结束");
            try {
                scanner.close();
            } catch (InputMismatchException e) {
                e.printStackTrace();
            }
        }
        
    }
    
}
